package firstquestion;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

public class ReadURL {
    public static void main(String[] args) {
        URL url=null;
        BufferedReader br = null;
        try {
            url = new URL("https://www.cnblogs.com/itboxue/p/10738810.html");
            br = new BufferedReader(new InputStreamReader(url.openStream()));
            String str;
            while ((str=br.readLine())!=null){
                System.out.println(str);
            }
            br.close();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (br!=null){
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
